FROM hashicorp/terraform:1.4.5 as terraform-1.4.5
FROM hashicorp/terraform:0.12.31

RUN mkdir -p /root/.terraform.d/plugins/linux_amd64/

RUN echo 'plugin_cache_dir = "/root/.terraform.d/plugin-cache"' > /root/.terraformrc

ADD build/terraform-provider-deeproute_v0.0.1 /root/.terraform.d/plugins/linux_amd64/
COPY build/terraform-provider-alicloud_v1.199.0 /root/.terraform.d/plugins/linux_amd64/

RUN mkdir -p /root/.terraform.d/plugins/terraform.local/local/maas/1.1.1/linux_amd64/
RUN mkdir -p /root/.terraform.d/plugin-cache

ADD build/terraform-provider-maas_v1.1.1 /root/.terraform.d/plugins/terraform.local/local/maas/1.1.1/linux_amd64/terraform-provider-maas_v1.1.1

COPY --from=terraform-1.4.5 /bin/terraform /bin/terraform-1.4.5

ENTRYPOINT ["/bin/sh"]
